
option explicit

class CHtmlBuilder

	public function sStyleSheet()
		dim oFS
		dim oF
		dim sCssFileName
		
		sCssFileName = Q_PATH & "/tooltips/default.css"
		set oFS = createobject("scripting.filesystemobject")
		set oF = oFS.OpenTextFile(sCssFileName)
		
		if not oF is nothing then
			sStyleSheet = oF.ReadAll()
		else
			oApp.oUI.oViewUI.ShowTip Q_ICON_BAD, oApp.oTranslator.Translation("Control Panel Error,, Imposible abrir el archivo ") & sCssFileName 
		end if
	end function

	

	public sub BeginTag(byref sHtml, byval sTag)
		sHtml = sHtml & "<"&sTag&">"
	end sub

	public sub EndTag(byref sHtml, byval sTag)
		sHtml = sHtml & "</"&sTag&">"
	end sub

	
	
	public sub AddStyleSheet(byref sHtml)
		sHtml = sHtml & "<style>" & sStyleSheet() & "</style>"
'		sHtml = sHtml & "<base href='file://..\..\tooltips\'></base>"
'		sHtml = sHtml & "<link rel=""stylesheet"" type=""text/css"" href=""../../tooltips/default.css""></link>"
	end sub

	public sub AddTitle(byref sHtml, byval sTitle, byval iLevel)
		sHtml = sHtml & "<h"&cstr(iLevel)&">" & sTitle & "</h"&cstr(iLevel)&">"
	end sub

	public sub AddText(byref sHtml, byval sText)
		sHtml = sHtml & "<p>" & sText & "</p>"
	end sub

	public sub AddBoldText(byref sHtml, byval sText)
		AddText sHtml, "<b>" & sText & "</b>"
	end sub


	public sub BeginHtml(byref sHtml)
		BeginTag sHtml, "html"
	end sub

	public sub EndHtml(byref sHtml)
		EndTag sHtml, "html"
	end sub


	public sub BeginTable(byref sHtml)
		BeginTag sHtml, "table"
	end sub

	public sub EndTable(byref sHtml)
		EndTag sHtml, "table"
	end sub


	public sub BeginTr(byref sHtml)
		BeginTag sHtml, "tr"
	end sub

	public sub EndTr(byref sHtml)
		EndTag sHtml, "tr"
	end sub


	public sub BeginTd(byref sHtml)
		BeginTag sHtml, "td"
	end sub

	public sub EndTd(byref sHtml)
		EndTag sHtml, "td"
	end sub

end class
